package cosc617_blackteam;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author Laura Semesky
 */

public class CommentCollection implements Iterable<Comment>{


    private ArrayList<Comment> comments;

    public CommentCollection() {
        comments = new ArrayList<>();
    }

    /**
     * @return Iterator of all comments
     */
    public I_CommentIterator getDefaultCommentIterator() {
        return new DefaultCommentIterator(this.comments);
    }

    public void addComment(Comment comment) {
        this.comments.add(comment);
    }


    /* (non-Javadoc)
     * @see java.lang.Iterable#iterator()
     * Iterator of all comments
     */
    @Override
    public Iterator<Comment> iterator() {
        return getDefaultCommentIterator();
    }
    
    /**
     * @return Iterator of all approved comments
     */
    public Iterator<Comment> approvedCommentIterator(){
    	return new ApprovedCommentIterator(comments);
    }

	/**
	 * @return Iterator of all unapproved comments
	 */
	public Iterator<Comment> unapprovedCommentIterator() {
		return new UnapprovedCommentIterator(comments);
	}

}
